package cn.com.fattiger.framework.cms.admin.common.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import cn.com.fattiger.framework.cms.admin.common.dao.AnswerRepository;
import cn.com.fattiger.framework.cms.admin.common.model.Answer;
import cn.com.fattiger.framework.cms.admin.common.service.AnswerService;

@Service
public class AnswerServiceImpl implements AnswerService {

	@Autowired
	private AnswerRepository answerRepository;
	
	
	@Override
	public void save(Answer entity) {
		answerRepository.save(entity);
	}

	@Override
	public void delete(Long id) {
		answerRepository.delete(id);
	}

	@Override
	public Page<Answer> list(Integer page, Integer pageSize) {
		Pageable pageable = new PageRequest(page, pageSize);
		return answerRepository.findAll(pageable);
	}

	@Override
	public Answer get(Long id) {
		return answerRepository.findOne(id);
	}

	@Override
	public Page<Answer> list(Integer page, Integer pageSize,
			Map<String, String> condition) {
		return null;
	}

	@Override
	public List<Answer> getOptionCount(Long questionId) {
		return answerRepository.getOptionCount(questionId);
	}

	@Override
	public List<Answer> list(Map<String, String> condition) {
		// TODO Auto-generated method stub
		return null;
	}

}
